package com.huawei.appgallery.updatemanager.ui.cardkit.card;

import android.content.Context;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import huawei.widget.HwSwitch;
import o.cep;
import o.cgz;
import o.chy;
import o.czk$c;
import o.czk.g;
import o.czp;
import o.czw;
import o.dbn;
import o.NetWorkUtil;

public class PreDownloadSwitchStateCard extends BaseDistCard {
    private TextView ˋ;
    private Context ॱॱ;
    private HwSwitch ᐝ;

    static class a implements OnCheckedChangeListener {
        private a() {
        }

        public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            new czw(compoundButton.getContext(), compoundButton).ॱ(z);
        }
    }

    public PreDownloadSwitchStateCard(Context context) {
        super(context);
        this.ॱॱ = context;
    }

    public cgz ˏ(View view) {
        this.ˋ = (TextView) view.findViewById(czk$c.ʿ);
        this.ᐝ = (HwSwitch) view.findViewById(czk$c.ʻॱ);
        if (cep.ˏ()) {
            this.ᐝ.setChecked(ॱ(this.ॱॱ));
        } else {
            this.ᐝ.setChecked(false);
        }
        this.ᐝ.setOnCheckedChangeListener(new a());
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        if (cep.ˏ()) {
            boolean ॱ = ॱ(this.ॱॱ);
            if (!(this.ᐝ == null || this.ᐝ.isChecked() == ॱ)) {
                this.ᐝ.setChecked(ॱ);
            }
        } else if (this.ᐝ != null && this.ᐝ.isChecked()) {
            this.ᐝ.setChecked(false);
        }
        this.ˋ.setText(NetWorkUtil.getWifiResId(this.ˊˋ.getContext(), g.ʿ));
        super.ˏ(cardBean);
    }

    public void ॱ(chy o_chy) {
    }

    private boolean ॱ(Context context) {
        return ((czp) dbn.ˎ(czp.class)).ˎ(context);
    }
}
